package com.sinux.generality.provider.demo.tool;

import org.springframework.beans.factory.annotation.Value;

public class OpenUtil {
    public static String tokenApi;
    public static String getModels(){
        String result = MyHttpUtil.getWithAuth("https://api.openai.com/v1/engines/text-davinci-003", tokenApi);
        return result;
    }

    public static String completions(String content){
        String param = "{ \"model\": \"gpt-3.5-turbo\", \"messages\": [{\"role\": \"user\", \"content\": \""+content+"\"}] }";
        String result = MyHttpUtil.postWithAuth("https://api.openai.com/v1/chat/completions", param, tokenApi);
        return result;
    }
}
